/**
 * @BelongsProject: gene-mutation-timeyan-host
 * @BelongsPackage: cn.gene.timeyan.pay.webapi.controller
 * @Author: 吕易
 * @CreateTime: 2022-08-16  14:01
 * @Description: TODO
 * @Version: 1.0
 */
package cn.gene.timeyan.pay.webapi.controller;

import cn.gene.timeyan.common.restful.JsonResult;
import cn.gene.timeyan.pay.service.IPointsExchangeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/pay/pointsExchange")
@Api(tags = "积分兑换")
public class PointsExchangeController {
    private final IPointsExchangeService pointsExchangeService;

    public PointsExchangeController(IPointsExchangeService pointsExchangeService) {
        this.pointsExchangeService = pointsExchangeService;
    }

    @PostMapping("/store/{goodsId}/{address}")
    @ApiOperation("商品页面的积分兑换")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "goodsId",value = "商品id",required = true,dataType = "long"),
            @ApiImplicitParam(name = "address",value = "收获地址",required = true,dataType = "string")
    })
    public JsonResult<Void> pointsExchange(@PathVariable Long goodsId,@PathVariable String address){
        pointsExchangeService.pointsExchange(goodsId,address);
        return JsonResult.ok();
    }
}

